package com.cxx.purchasecharge.core.model.persistence;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.cxx.purchasecharge.core.model.BaseModel;

/**
 * 信用等级, 如合作伙伴，老客户，普通客户，VIP客户
 */
@Entity
@Table (name = "pc_customer_level")
public class CustomerLevel extends BaseModel
{
    private static final long serialVersionUID = 1L;

    private long id;
    private String name;
    private float standardPercent;
    private String comment;
    
    private List<Customer> customers;
    
    public CustomerLevel () {}
    public CustomerLevel (String name) 
    {
        this.name = name;
    }

    @Id
    @GeneratedValue (strategy = GenerationType.AUTO)
    public long getId ()
    {
        return id;
    }

    public void setId (long id)
    {
        this.id = id;
    }

    @Column (nullable = false, unique = true)
    public String getName ()
    {
        return name;
    }

    public void setName (String name)
    {
        this.name = name;
    }

    public float getStandardPercent ()
    {
        return standardPercent;
    }

    public void setStandardPercent (float standardPercent)
    {
        this.standardPercent = standardPercent;
    }

    @Column (length = 2048)
    public String getComment ()
    {
        return comment;
    }

    public void setComment (String comment)
    {
        this.comment = comment;
    }

    @OneToMany(mappedBy="customerLevel")
    public List <Customer> getCustomers ()
    {
        return customers;
    }

    public void setCustomers (List <Customer> customers)
    {
        this.customers = customers;
    }
    
}
